package com.example.urmsadmin.Util;

import org.springframework.util.DigestUtils;

import java.security.NoSuchAlgorithmException;
import java.util.UUID;

public class SaltEncryption {

    //盐值加密
    public static String saltEncryption(String password, String salt) throws NoSuchAlgorithmException {
        String current = password + salt;
        return DigestUtils.md5DigestAsHex(current.getBytes());
    }

    public static void main(String[] args) throws NoSuchAlgorithmException {
        String salt = UUID.randomUUID().toString().substring(0, 6);

        System.out.println(salt+"---"+SaltEncryption.saltEncryption("11111",salt));
    }

}
